package com.sky.controller.admin;

import com.sky.service.WorkspaceService;
import com.sky.utils.DateUtils;
import com.sky.web.controller.BaseController;
import com.sky.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * @Author tzl
 * @Date 2023/8/13 20:40  星期日
 * @ClassName WorkSpaceController
 * @Description 工作台相关接口
 */
@RestController
@RequestMapping("/admin/workspace")
@Slf4j
@Api(tags = "工作台相关接口")
public class WorkSpaceController extends BaseController {

    @Autowired
    private WorkspaceService workspaceService;

    /**
     * 工作台今日数据查询
     * @return
     */
    @GetMapping("/businessData")
    @ApiOperation("工作台今日数据查询")
    public AjaxResult businessData(){
        //获得当天的开始时间
        String begin = DateUtils.getDate() + " 00:00:00";
        String end = DateUtils.getDate() + " 23:59:59";

        Map<String,Object> map = workspaceService.getBusinessData(begin, end);
        return AjaxResult.success(map);
    }

    /**
     * 查询订单管理数据
     * @return
     */
    @GetMapping("/overviewOrders")
    @ApiOperation("查询订单管理数据")
    public AjaxResult orderOverView(){
        Map<String,Object> map = workspaceService.getOrderOverView();
        return AjaxResult.success(map);
    }

    /**
     * 查询菜品总览
     * @return
     */
    @GetMapping("/overviewDishes")
    @ApiOperation("查询菜品总览")
    public AjaxResult dishOverView(){
        Map<String,Object> map = workspaceService.getDishOverView();
        return AjaxResult.success(map);
    }

    /**
     * 查询套餐总览
     * @return
     */
    @GetMapping("/overviewSetmeals")
    @ApiOperation("查询套餐总览")
    public AjaxResult setmealOverView(){
        Map<String,Object> map = workspaceService.getSetmealOverView();
        return AjaxResult.success(map);
    }
}
